package cn.iocoder.yudao.module.vote.service.voteuserresult.strategy;

import cn.iocoder.yudao.module.vote.constants.Const;
import cn.iocoder.yudao.module.vote.constants.VotePersonTypeEnum;
import cn.iocoder.yudao.module.vote.controller.admin.voterecorddetail.vo.VoteRecordCountVO;
import cn.iocoder.yudao.module.vote.dal.dataobject.voteuserresult.VoteUserResultDO;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

import static cn.iocoder.yudao.module.vote.constants.ScopeTypeEnum.*;
import static cn.iocoder.yudao.module.vote.constants.ScopeTypeEnum.TEAM_BUILDING;

@Service
public interface ScopeStrategy {

    /**
     * 统计分数
     * @return
     */
    public BigDecimal totalScope(Integer voteId, Integer userResultId,Integer type);


    /**
     * 平均值
     * @param resultDO
     * @param voteId
     */
    public void avgScope(VoteUserResultDO resultDO, Integer voteId);


    /**
     * 得分计算
     * @param recordCountVO
     * @return
     */
    default double calculateScore(VoteRecordCountVO recordCountVO) {

        return recordCountVO.getKeyTasks() * Const.getScopeTypeWeight(KEY_TASKS.getName(),recordCountVO.getKeyTasks()) +
                recordCountVO.getProgress()* Const.getScopeTypeWeight(PROGRESS.getName(),recordCountVO.getProgress()) +
                recordCountVO.getCollaboration()* Const.getScopeTypeWeight(COLLABORATION.getName(),recordCountVO.getCollaboration()) +
                recordCountVO.getTeamBuilding()* Const.getScopeTypeWeight(TEAM_BUILDING.getName(),recordCountVO.getTeamBuilding());
    }
}
